<?php
    /**
     * difF PHP Framework :: sessions.php
     *
     * @version: 0.6
     * @date   : 12/09/2012
     * @author Melisides Constantinos (dsphinx@gmail.com)
     * @Description: dump php html httpd header status
     *
     *
     * Licensed under MIT licence:
     *   http://www.opensource.org/licenses/mit-license.php
     *


    if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
        '127.0.0.1',
        '::1',
        '192.168.70.61',
        '192.168.70.10'
    ))
    ) {
        header('HTTP/1.0 403 Forbidden');
        exit('This script is only accessible from localhost.');
    }

    if (RUNNING_MODE != "sandbox") //   Development phase - sandbox
    {
        header('HTTP/1.0 403 Forbidden');
        exit('This script is only accessible from localhost.');
    }
     */

    if (!defined("DEBUG"))
        DEFINE("DEBUG", TRUE);
//debug_sessions
//
//   fancy array output
    function __diff_print_r_html($data, $return_data = FALSE)
    {
        $data = print_r($data, TRUE);
        $data = str_replace(" ", "&nbsp;", $data);
        $data = str_replace("\r\n", "<br>\r\n", $data);
        $data = str_replace("\r", "<br>\r", $data);
        $data = str_replace("\n", "<br>\n", $data);

        if (!$return_data)
            echo $data;
        else
            return $data;
    }


    echo "<br><h3> _SESSION </h3> ";// .session_id();
    __diff_print_r_html($_SESSION);

    echo "<hr> <br><h3>  _REQUEST  </h3>";
    __diff_print_r_html($_REQUEST);

    echo "<hr> <br><h3>  _POST </h3> ";
    __diff_print_r_html($_POST);

    echo "<hr> <br><h3>  _COOKIE </h3> ";
    __diff_print_r_html($_COOKIE);

    echo "<hr> <br><h3>  _GET </h3> ";
    __diff_print_r_html($_GET);

    echo "<hr> <br><h3>  _SERVER </h3> ";
    __diff_print_r_html($_SERVER);

    echo "<hr> <br><h3>  _ENV </h3> ";
    __diff_print_r_html($_ENV);


    echo "<hr> <br><h3>  Framework Structure : included files </h3> ";
    __diff_print_r_html(get_included_files());


// echo "<hr> <br><h3>  GLOBALS </h3> ";    __diff_print_r_html($GLOBALS);			// All of the above
// echo "<hr> <br><h3>  Defined constants  </h3> ";    __diff_print_r_html(get_defined_constants(true));
// echo "<hr> <br><h3>  Loaded extensions </h3> ";    __diff_print_r_html( get_loaded_extensions());
// echo "<hr> <br><h3>  ini_get_all </h3> ";    __diff_print_r_html( ini_get_all());


    echo "<hr> <br><h3>  PATH </h3> ";
    $pathsa = explode(":", get_include_path());
    __diff_print_r_html($pathsa);


    echo "<hr> <br/>";
    echo 'Script owner: ' . get_current_user() . "  <br>   id=" . getmygid() . " <br> pid=" . getmypid() . "  <br> last modified " . date("F d Y H:i:s.", getlastmod()) . " <br/>";
    echo "<br /> Memory peak usage : " . memory_get_peak_usage(TRUE);
    echo "<br /> Memory get usage : " . memory_get_usage(TRUE);

    echo "<br /> File : " . __FILE__;
    echo "<br /> Nmaespace : " . __NAMESPACE__;

    echo "<br />  <hr> <br/>";
    echo "difF Config Version : " . difF_LIB_VERSION;

    echo "<pre>";
    include($_SESSION['PATHS']['__ROOT__'] . "/README");
    echo "</pre>";
?>
//debug sessions